package com.ehotting.edsta.diagnosisPredict.feign.factory;

import com.ehotting.eaf.core.web.domain.diagnosisPredict.PageDto;
import com.ehotting.eaf.core.web.domain.diagnosisPredict.Response;
import com.ehotting.edsta.diagnosisPredict.domain.dto.ConnectInfoDto;
import com.ehotting.edsta.diagnosisPredict.domain.dto.SQLRequestDto;
import com.ehotting.edsta.diagnosisPredict.feign.DatabaseInfoFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 建模数据管理模块的降级处理
 * 
 * @author edsta
 */
@Slf4j
@Component
public class DatabaseInfoFallbackFactory implements FallbackFactory<DatabaseInfoFeignService> {

    @Override
    public DatabaseInfoFeignService create(Throwable throwable)
    {
        log.error("建模数据管理模块调用失败:{}", throwable.getMessage());
        return new DatabaseInfoFeignService() {
            @Override
            public Response<String> insertDatabase(ConnectInfoDto dto) {
                return null;
            }

            @Override
            public Response<String> updateDatabase(Long id, String password, String user) {
                return null;
            }

            @Override
            public Response<List<ConnectInfoDto>> history(String creater) {
                return null;
            }

            @Override
            public Response<PageDto<String>> getTableList(Long id, String likeStr, Integer page, Integer pageSize) {
                return null;
            }

            @Override
            public Response<Map<String, Object>> getByTable(Long id, String tableName) {
                return null;
            }

            @Override
            public Response<Map<String, Object>> getBySql(SQLRequestDto requestDto) {
                return null;
            }


        };
    }
}
